cmake_minimum_required(VERSION 3.20)

project("fast_dds_learn")

# 编译选项
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-O2)
add_compile_options(-g)
# add_compile_options(-Wall -Wextra -Wpedantic)

# Find requirements
# set(protobuf_FOUND TRUE)
# find_package(absl CONFIG REQUIRED)
find_package(fastcdr 2 REQUIRED)
find_package(fastrtps 2.12 REQUIRED)
find_package(protobuf REQUIRED)

set(PROJECT_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
message(STATUS "PROJECT_ROOT_DIR is ${PROJECT_ROOT_DIR}")
include_directories(${PROJECT_ROOT_DIR})
include_directories(${PROJECT_ROOT_DIR}/base)
include_directories(${PROJECT_ROOT_DIR}/idl)
include_directories(${PROJECT_ROOT_DIR}/side_packages/protobuf/include)
include_directories(${PROJECT_ROOT_DIR}/side_packages/fast_dds/include)

link_directories(${PROJECT_ROOT_DIR}/side_packages/fast_dds/lib)
link_directories(${PROJECT_ROOT_DIR}/side_packages/protobuf/lib)

# 编译 idl
add_subdirectory("idl")

# 编译 proto
add_subdirectory("proto_cpp")

# 编译 model
add_subdirectory("leo_motion_sim")    # 编译失败

add_subdirectory("simple_protobuf")
add_subdirectory("base")
add_subdirectory("simple_client_server")
add_subdirectory("simple_publisher")